const detailseller = require('./mock/detail-seller.json')
const detailgoods = require('./mock/detail-goods.json')
const detailratings = require('./mock/detail-ratings.json')
const detailrecommend = require('./mock/detail-recommend.json')
const getfind2 = require('./mock/find-con1.json')
const getfind3 = require('./mock/find-yh.json')
const gethometop = require('./mock/home-top.json')
const getrestaurant = require('./mock/resturant1.json')
const getsearch = require('./mock/search.json')
const getcity = require('./mock/city.json')
const getmime1 = require('./exchangelist.json')
const getmime2 = require('./getinfo.json')
const getuser = require('./user.json')
module.exports = {
  devServer: {
    before (app) {
      // find 模块的为你推荐
      app.get('/api/getfind2', (req, res) => {
        res.send(getfind2)
      })
      // find 模块的优惠
      app.get('/api/getfind3', (req, res) => {
        res.send(getfind3)
      })
      // home 模块顶部轮播图
      app.get('/api/gethometop', (req, res) => {
        res.send(gethometop)
      })
      // home 主页商家
      app.get('/api/getrestaurant', (req, res) => {
        res.send(getrestaurant)
      })
      // city 城市选择
      app.get('/api/getcity', (req, res) => {
        res.send(getcity)
      })
      // search 搜索数据
      app.get('/api/getsearch', (req, res) => {
        res.send(getsearch)
      })
      app.get('/api/getmime1', (req, res) => {
        res.send(getmime1)
      })
      app.get('/api/getmime2', (req, res) => {
        res.send(getmime2)
      })
      // detail页面数据--seller
      app.get('/api/getdetail/seller', (req, res) => {
        res.send(detailseller)
      })
      // detail页面数据--goods
      app.get('/api/getdetail/goods', (req, res) => {
        res.send(detailgoods)
      })
      // detail页面数据--ratings
      app.get('/api/getdetail/ratings', (req, res) => {
        res.send(detailratings)
      })
      // detail商品详情
      app.get('/api/getdetail/goods/goodinfo:id', (req, res) => {
        res.send(detailgoods)
      })
      // detail页面数据--recommend
      app.get('/api/getdetail/recommend', (req, res) => {
        res.send(detailrecommend)
      })
      app.get('/api/getuserinfo', (req, res) => {
        res.send(getuser)
      })
      // app.post('/api/getuserinfo', (req, res) => {
      //   getuser.push(req)
      // })
    }
  }
}
